﻿using AutoMapper;
using FarmSmartSleep.Common.Domain.BeginTable;
using FarmSmartSleep.Common.Dtos;
using FarmSmartSleep.Common.Infrastructure;
using MediatR;

namespace FarmSmartSleep.Organ.API.Application.SleepInfoCommands.RecordCommands
{
    public class SheepInforTypeHandler : IRequestHandler<SheepInforTypeCommand, Result>
    {
        public IBaseRepository<SleepInfor> sleepInforRepository;
        public IMapper mapper;

        public SheepInforTypeHandler(IBaseRepository<SleepInfor> sleepInforRepository, IMapper mapper)
        {
            this.sleepInforRepository = sleepInforRepository;
            this.mapper = mapper;
        }

        //男性耳号下拉框
        public async Task<Result> Handle(SheepInforTypeCommand request, CancellationToken cancellationToken)
        {
            var result= new Result() { Code=(int)CodeEnum.search};
            var list=sleepInforRepository.GetAll().Where(x=>x.Gender==1).ToList();
            result.Data = list;
            return result;
        }
    }
}
